import { createRouter, createWebHashHistory } from "vue-router";
import Home from "../views/Home.vue";
import Welcome from "../views/welcome.vue";
import Login from "../views/login.vue";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      name: "login",
      path: "/login",
      meta: {
        title: "登录",
      },
      component: Login,
    },
    {
      name: "name",
      path: "/",
      component: Home,
      meta: { title: "首页" },
      redirect: "/welcome",
      children: [
        {
          name: "welcome",
          path: "/welcome",
          meta: { title: "欢迎哥哥" },
          component: Welcome,
        },
        {
          name: "user",
          path: "user",
          meta: { title: "用户页" },
          component: () => import("../views/User.vue"),
        },
      ],
    },
  ],
});

export default router;
